package cn.lingyangwl.agile.auth.controller;

import cn.lingyangwl.agile.auth.model.rqrs.third.ThirdFirstBindReq;
import cn.lingyangwl.agile.auth.oauth2.model.OAuth2TokenResp;
import cn.lingyangwl.agile.auth.service.ThirdUserService;
import cn.lingyangwl.framework.core.response.Resp;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 这里用于工程第三方的授权, 即使是多租户的, 一般也不会让对外提供的租户配置这种三分登录渠道
 * , 所以这里统一由平台租户管理
 *
 * @author shenguangyang
 */
@Slf4j
@Api(tags = "第三方用户")
@RestController
@RequestMapping("/thirdUser")
public class ThirdUserController {
    @Resource
    private ThirdUserService thirdUserService;

    /**
     * 绑定已有账号账号
     */
    @PostMapping("/bind")
    public Resp<OAuth2TokenResp> firstBind(@Validated @RequestBody ThirdFirstBindReq req) {
//        return Resp.ok(thirdUserService.firstBind(req));
        return Resp.ok();
    }

    /**
     * 注册并绑定账号
     */
    @PostMapping("/registerAndBind")
    public Object registerAndBind() {
        return "ok";
    }
}
